<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>2.29</title>
</head>
<body>
    <script>
        let arr = Array.of(1,2,1,3);
        console.log(arr.findIndex(item => item == 2));  //1

        //数组空位处理为undefined
        console.log([,1].findIndex(n => true)); //0
    </script>
</body>
</html>